﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_dept.aspx.cs" Inherits="AnyOffice.general.system.user.user_dept" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>user_new</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script Language="JavaScript">

function delete_user(user_id)
{
 msg='确认要删除用户 '+user_id+' 么？';
 if(window.confirm(msg))
 {
  URL="delete.aspx?dept_id=<%=ViewState["DeptId"]%>&user_id=" + user_id;
  window.location=URL;
 }
}

function no_pass(user_id)
{
 msg='确认要清空用户 '+user_id+' 的密码么？';
 if(window.confirm(msg))
 {
  URL="no_pass.aspx?dept_id=<%=ViewState["DeptId"]%>&user_id=" + user_id;
  window.location=URL;
 }
}

function create_key(user_id)
{
 msg='确认已插入用户KEY?';
 if(window.confirm(msg))
 {
  URL="create_key.aspx?dept_id=<%=ViewState["DeptId"]%>&user_id=" + user_id;
  window.location=URL;
 }
}
</script>
	</HEAD>
	<body class="bodycolor" topMargin="5">
		<form id="Form1" method="post" runat="server">
			<table class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<tr>
					<td class="Big"><IMG src="/images/notify_open.gif" align="absMiddle"><span class="big3">
							管理用户 （<asp:label id="lblDeptName" runat="server"></asp:label>）-
							<asp:label id="lblUserCount" runat="server">0</asp:label>人</span>
					</td>
				</tr>
			</table>			
			<asp:repeater id="Repeater1" runat="server">
				<HeaderTemplate>
					<table align="center" border="0" cellspacing="1" width="90%" class="small" bgcolor="#000000"
						cellpadding="3">
						<TR class="TableHeader">
							<td nowrap align="center">用户名</td>
							<td nowrap align="center">真实姓名</td>
							<td nowrap align="center">角色</td>
							<td nowrap align="center">管理范围</td>
							<td nowrap align="center">帐户状态</td>
							<td nowrap align="center">操作</td>
						</TR>
				</HeaderTemplate>
				
				<ItemTemplate>
					<tr class="TableLine1">
						<td nowrap align="center"><%#Eval("UserId")%></td>
						</td>
						<td nowrap align="center"><%#Eval("UserName")%></td>
						<td nowrap align="center"><%#Eval("PrivName")%></td>
						<td nowrap align="center">
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 0 ? "本部门" : ""%>
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 1 ? "全体" : ""%>
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 2 ? "指定部门" : ""%>
						</td>
						<td nowrap align="center">
							<%#Convert.ToBoolean(Eval("Disabled").ToString()) == false ? "<img src='/images/enable.gif' title='启用'>" : "<img src='/images/disable.gif' title='禁用'>"%>
						</td>
						<td nowrap>&nbsp;
							<a href="user_edit.aspx?dept_id=<%=ViewState["DeptId"]%>&user_id=<%#Eval("UserId")%>">编辑</a>&nbsp;
							
							<a href="javascript:no_pass('<%#Eval("UserId")%>');">清空密码</a>&nbsp;
							<%#Eval("UserId").ToString() != User.Identity.Name ? "<a href=\"javascript:delete_user('" + Eval("UserId").ToString() + "');\">删除</a>" : ""%>
						</td>
					</tr>
				</ItemTemplate>
				<AlternatingItemTemplate>
					<tr class="TableLine2">
						<td nowrap align="center"><%#Eval("UserId")%></td>
						</td>
						<td nowrap align="center"><%#Eval("UserName")%></td>
						<td nowrap align="center"><%#Eval("PrivName")%></td>
						<td nowrap align="center">
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 0 ? "本部门" : ""%>
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 1 ? "全体" : ""%>
							<%#Convert.ToInt32(Eval("PostPriv").ToString()) == 2 ? "指定部门" : ""%>
						</td>
						<td nowrap align="center">
							<%#Convert.ToBoolean(Eval("Disabled").ToString()) == false ? "<img src='/images/enable.gif' title='启用'>" : "<img src='/images/disable.gif' title='禁用'>"%>
						</td>
						<td nowrap>&nbsp;
							<a href="user_edit.aspx?dept_id=<%=ViewState["DeptId"]%>&user_id=<%#Eval("UserId")%>">编辑</a>&nbsp;
							
							<a href="javascript:no_pass('<%#Eval("UserId")%>');">清空密码</a>&nbsp;
							<%#Eval("UserId").ToString() != User.Identity.Name ? "<a href=\"javascript:delete_user('" + Eval("UserId").ToString() + "');\">删除</a>" : ""%>
						</td>
					</tr>
				</AlternatingItemTemplate>
				<FooterTemplate>			
					</table>
				</FooterTemplate>
			</asp:repeater>
			<asp:label id="lblMessage" runat="server"></asp:label>
			</form>
	</body>
</HTML>
